package com.uuah.server.config.spring.parsers.processors;

import org.w3c.dom.Element;

import com.uuah.server.config.spring.parsers.AbstractUuahBeanDefinitionParser;
import com.uuah.server.config.spring.parsers.PreProcessor;
import com.uuah.server.config.spring.parsers.assembly.configuration.IPropertyConfiguration;
import com.uuah.server.config.spring.parsers.generic.AutoIdUtils;

public class ProvideDefaultName implements PreProcessor {

	private String prefix;

	public ProvideDefaultName(String prefix) {
		this.prefix = prefix;
	}

	public void preProcess(IPropertyConfiguration config, Element element) {
		element.setAttribute(AbstractUuahBeanDefinitionParser.ATTRIBUTE_NAME,
				AutoIdUtils.getUniqueName(element, prefix));
	}

}
